package cn.edu.hust.sse.software7.class3.serviceImpl;

import java.util.Date;
import java.util.List;

import cn.edu.hust.sse.software7.class3.DAO.EBTradingDAO;
import cn.edu.hust.sse.software7.class3.entities.EBTrading;
import cn.edu.hust.sse.software7.class3.service.EBTradingService;

public class EBTradingServiceImpl implements EBTradingService {
	EBTradingDAO dao = new EBTradingDAO();

	public EBTradingServiceImpl() {
		if (null == dao) {
			dao = new EBTradingDAO();
		}
	}

	@Override
	public void addTrading(EBTrading trade) {
		dao.addTrading(trade);
	}

	@Override
	public List<EBTrading> getTradingHistoryByUser(Long userId) {
		return dao.getTradingHistoryByUser(userId);
	}

	@Override
	public List<EBTrading> getTradingHistoryByProd(Long prodId) {
		return dao.getTradingHistoryByProd(prodId);
	}

	@Override
	public List<EBTrading> getTradingHistoryByDateScope(Date from, Date to) {
		return dao.getTradingHistoryByDateScope(from, to);
	}

	@Override
	public List<EBTrading> getAllTradingHistory() {
		return dao.getAllTradingHistory();
	}

	@Override
	public EBTrading getTradingById(Long tradeId) {
		return dao.getTradingById(tradeId);
	}

	@Override
	public void deleteTradingHistoryByUser(Long userId) {
		dao.deleteTradingHistoryByUser(userId);
	}

	@Override
	public void deleteTradingHistoryByProd(Long prodId) {
		dao.deleteTradingHistoryByProd(prodId);
	}

}
